<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/table.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/dwz/themes/default/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="${pageContext.request.contextPath}/dwz/themes/css/core.css" rel="stylesheet" type="text/css" media="screen" />
<script src="${pageContext.request.contextPath}/jquery/jquery-2.1.4.min.js" type="text/javascript"></script>
<table border="0" cellpadding="0" cellspacing="0" class="table_border">
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="table_padding">
				<tr>
					<td><font style="font-size: 12px; color: red;"><strong>提示：点击左边树上的节点查看许可详情</strong></font>
					</td>
					<td width="25" height="26" align="right"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="table_border">
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="table_right">
				<tr>
					<td><font style="font-size: 12px;"><strong>许可详细信息</strong></font>
					</td>
					<td width="25" height="26" align="left"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" cellspacing="0" class="table_right">
				<tr>
					<td align="center">
						<table border="0" cellpadding="0" cellspacing="0"
							class="box_table" id="box_table2">
							<thead>
								<tr>
									<td>名称：</td>
									<td>${permission.name}</td>
								</tr>
								<tr>
									<td>模块URL：</td>
									<td>${permission.moduleUrl}</td>
								</tr>
								<tr>
									<td>操作URL：</td>
									<td>${permission.operationUrl}</td>
								</tr>
								<tr>
									<td>排序号：</td>
									<td>${permission.orderNo}</td>
								</tr>
							</thead>
							<tbody>
							</tbody>
						</table>
						<table border="0" cellpadding="0" cellspacing="0"
							class="operation">
							<thead>
								<tr>
									<td height="24">&nbsp;</td>
								</tr>
							</thead>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="table_padding">
				<tr>
					<td height="21" align="right">
						<table align="left">
							<tr>
								<td width="50px"><a class="button" href="permission?method=add&id=${permission.id}"><span>新增</span></a></td>
								<td width="50px"><a class="button" onclick="del();" href="javascript:void(0);"><span>删除</span></a></td>
								<td width="50px"><a class="button" href="permission?method=edit&id=${permission.id}" ><span>修改</span></a></td>
								<span id="mesg" style="color: red"></span>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<script>
	function del(){
		var flag = confirm("确定要删除选中的权限?");
		if (flag){
			$.get("permission?method=del&id=${permission.id}",function(result){
				if (result.code == "200"){
					$("#mesg").text(result.mesg);
					//删除权限后处理页面信息
					//获取父节点
					var treeObj = parent.treeFrame.$.fn.zTree.getZTreeObj("permission_tree");
					//获取选中的节点
					var node =  treeObj.getSelectedNodes()[0];
					//获取选中节点的父节点
					var parentNode = node.getParentNode();
					//通过ztree对象选中父节点
					treeObj.selectNode(parentNode);
					//使workarea区域显示权限的详细信息
					parent.workareaFrame.location = "permission?method=detail&id="+parentNode.id;
					//通过树对象删除节点
					treeObj.removeNode(node);
				}else{
					$("#mesg").text(result.mesg);
				}
			});
		}
	}
</script>